import 'package:flutter/material.dart';

class ScreenModalTheme extends ThemeExtension<ScreenModalTheme> {
  final Color backgroundColor;
  final Color indicatorColor;
  final Color closeButtonColor;
  final Color completeButtonColor;
  final TextStyle closeButtonTextStyle;
  final TextStyle completeButtonTextStyle;

  ScreenModalTheme({
    required this.backgroundColor,
    required this.indicatorColor,
    required this.closeButtonColor,
    required this.completeButtonColor,
    required this.closeButtonTextStyle,
    required this.completeButtonTextStyle,
  });

  @override
  ScreenModalTheme copyWith({
    Color? backgroundColor,
    Color? indicatorColor,
    Color? closeButtonColor,
    Color? completeButtonColor,
    TextStyle? closeButtonTextStyle,
    TextStyle? completeButtonTextStyle,
  }) {
    return ScreenModalTheme(
      backgroundColor: backgroundColor ?? this.backgroundColor,
      indicatorColor: indicatorColor ?? this.indicatorColor,
      closeButtonColor: closeButtonColor ?? this.closeButtonColor,
      completeButtonColor: completeButtonColor ?? this.completeButtonColor,
      closeButtonTextStyle: closeButtonTextStyle ?? this.closeButtonTextStyle,
      completeButtonTextStyle:
          completeButtonTextStyle ?? this.completeButtonTextStyle,
    );
  }

  @override
  ScreenModalTheme lerp(ThemeExtension<ScreenModalTheme>? other, double t) {
    if (other is! ScreenModalTheme) return this;

    return ScreenModalTheme(
      backgroundColor: Color.lerp(backgroundColor, other.backgroundColor, t)!,
      indicatorColor: Color.lerp(indicatorColor, other.indicatorColor, t)!,
      closeButtonColor:
          Color.lerp(closeButtonColor, other.closeButtonColor, t)!,
      completeButtonColor:
          Color.lerp(completeButtonColor, other.completeButtonColor, t)!,
      closeButtonTextStyle:
          TextStyle.lerp(closeButtonTextStyle, other.closeButtonTextStyle, t)!,
      completeButtonTextStyle: TextStyle.lerp(
          completeButtonTextStyle, other.completeButtonTextStyle, t)!,
    );
  }
}
